package com.zkt.subject.infra.basic.service.impl;

import cn.hutool.core.util.ObjectUtil;
import com.zkt.subject.infra.basic.entity.SubjectMapping;
import com.zkt.subject.infra.basic.mapper.SubjectMappingMapper;
import com.zkt.subject.infra.basic.service.ISubjectMappingService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 题目分类关系表 服务实现类
 * </p>
 *
 * @author zkt
 * @since 2024-10-05
 */
@Service
public class SubjectMappingServiceImpl extends ServiceImpl<SubjectMappingMapper, SubjectMapping> implements ISubjectMappingService {
	
	/**
	 * 根据条件查询
	 *
	 * @param subjectMapping 查询条件
	 * @return 查询结果
	 */
	@Override
	public List<SubjectMapping> queryList(SubjectMapping subjectMapping) {
		return this.lambdaQuery()
				.eq(ObjectUtil.isNotNull(subjectMapping.getId()), SubjectMapping::getId,
						subjectMapping.getId())
				.eq(ObjectUtil.isNotNull(subjectMapping.getSubjectId()), SubjectMapping::getSubjectId,
						subjectMapping.getSubjectId())
				.eq(ObjectUtil.isNotNull(subjectMapping.getCategoryId()), SubjectMapping::getCategoryId,
						subjectMapping.getCategoryId())
				.eq(ObjectUtil.isNotNull(subjectMapping.getLabelId()), SubjectMapping::getLabelId,
						subjectMapping.getLabelId())
				.list();
	}
	
}
